<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
   <link rel="stylesheet" href="__PUBLIC__/Css/Admin/common.css">
   <link rel="stylesheet" href="__PUBLIC__/Css/Admin/main.css">
   <script type="text/javascript" src="__PUBLIC__/Js/Admin/jquery.min.js"></script>
   <title>编辑景点门票类型</title>
   
   <script type="text/javascript">
       $(function(){
    	// 提交前check
    	   checkBeforeSubmit();
       });
       
       // 提交前check
       function checkBeforeSubmit(){
    	   $("#save_button").click(function(){
    		   // 入口城市ID
    		   var entryCityId = $("input[name='entryCityId']").val();
    		   // 城市ID
    		   var cityId = $("select[name='city'] :selected").val();
    		   if($.trim(entryCityId) == ""){
    			   $.ajax({
    	    			  url:"__URL__/hasEntryCity",
    	    			  type:"POST",
    					  async: false,
    					  data: "city=" + $.trim(cityId),
    					  dataType: "text",
    					  success:function(respData) {
    						   if(respData == "false"){
    							   alert("当前入口城市已经存在，请重新选择！");
    						   } else if(respData == "true"){
    							   $("#entryCity_form").submit(); 
    						   }
    					  },
    					  error:function(){
    					    	
    					  }
    	    		   });
    		   } else {
    			   $("#entryCity_form").submit(); 
    		   }
    	   });
       }
   </script>
</head>
<body>
<div id="forms" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top">
            	<b class="pl15">{$title}</b>
            	<a class="ext_btn" onclick="location.href='javascript:history.go(-1)'" style="float:right;margin-right:10px;margin-top:5px;">返回</a>
            </div>
            <div class="box_center">
              <form action="{:U('Authority/saveEntryCity')}" class="jqtransform" id="entryCity_form" method="post" enctype="multipart/form-data">
                <input type="hidden" name="entryCityId" value="{$entryCity.id}">
               <table class="form_table pt15 pb15" style="width:100%">
                 <tr>
                  <td class="td_right"><label style="color:red;">*</label>城市：</td>
                  <td>
                    <div class="select_border"> 
                        <div class="select_containers "> 
                        <select name="city" class="select"> 
                        	<foreach name="cityList" item="city">
                        		<if condition="$city.id eq ($entryCity['id'])">
                        			<option value="{$city.id}" selected>{$city.name}</option>
                        		<else />
                        			<option value="{$city.id}">{$city.name}</option>
                        		</if>
                        	</foreach> 
                        </select> 
                        </div> 
                      </div>
                  </td>
                </tr>
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
                     <input type="button" name="save_button" id="save_button" class="btn btn82 btn_save2" value="保存"> 
                    <input type="reset" name="reset_button" class="btn btn82 btn_res" value="重置">
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
</body>
</html>